package ai.people.netmon.framework.domain.ethereum.monitor.request;

import ai.people.netmon.framework.domain.ethereum.monitor.entity.EthereumUsers;
import ai.people.netmon.framework.model.request.PageKeyWordsRequest;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

/**
 * eth请求实体
 *
 * @author zhenglin
 * @since 2022/3/15
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class QueryRequest extends PageKeyWordsRequest {

    public LambdaQueryWrapper<EthereumUsers> createWrapper(){
        LambdaQueryWrapper<EthereumUsers> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(this.getSearchKeywords())){
            queryWrapper.like(EthereumUsers::getName,this.getSearchKeywords());
        }
        return queryWrapper;
    }
}
